<?php

namespace App\Exceptions;

use App\Api\Helpers\ApiResponse;
use Exception;
use Illuminate\Http\Request;

class InvalidRequestException extends Exception
{
    use ApiResponse;

    public function __construct(string $message = "", int $code = 400)
    {
        parent::__construct($message, $code);
    }

    public function render(Request $request)
    {
        if ($request->expectsJson()) {
            return $this->failed($this->message, $this->code);
        }

        // todo 普通网页异常处理
    }
}
